<?php

namespace App\Admin;

use Illuminate\Database\Eloquent\Model;
use App\Libs\GetTableDataLuRuTrait;
use App\Libs\GetTableDataTrait;

class SampleInfo extends Model
{
    protected $table = 'a_sample_info';
    public $timestamps = false;
    // protected $fillable = ['age'];//可以被批量赋值的属性 
    // protected $guarded = ['id','price'];//不能被批量赋值的属性
    public static function dbStat($key='') {
        $data = [
            'status0' => [
                // -1-被驳回，0-未提交，1-已提交，2-审核通过，3-未试验，4-试验中
                '-1' => '被驳回',
                '0'  => '未提交',
                '1'  => '已提交',
                '2'  => '审核通过',
                '3'  => '未试验',
                '4'  => '试验中',
            ],
            'status0_class' => [
                // -1-被驳回，0-未提交，1-已提交，2-审核通过，3-未试验，4-试验中
                '-1' => 'danger',
                '0'  => 'primary',
                '1'  => 'primary',
                '2'  => 'default',
                '3'  => 'default',
                '4'  => 'default',
            ],
            'res' => [
                // 0-未检测，1-合格，2-不合格
                '0'  => '未检测',
                '1'  => '合格',
                '2'  => '不合格',
            ],
            'res_class' => [
                // 0-未检测，1-合格，2-不合格
                '0'  => 'primary_outline',
                '1'  => 'primary',
                '2'  => 'danger',
            ]
        ];
        return $key ? $data[$key] : $data;
    }

    public function contract_gaiyao() {
        return $this->belongsTo('App\Admin\ContractGaiyao');
    }

    /* public function manager()
    {
        return $this->belongsTo('App\Admin\Manager');
    } */

    use GetTableDataLuRuTrait;
    use GetTableDataTrait;
}
